package com.example.spring.demo.service;

import com.example.spring.demo.mapper.UserMapper;
import com.example.spring.demo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liangchao
 * 11/18/18 4:53 PM
 */
@Service
public class UserServiceImple {

    @Autowired
    private UserMapper userMapper;

    public void insert(User user) {
        userMapper.insert(user);
    }

    public void delete(int id) {
        userMapper.deleteByPrimaryKey(id);
    }

    public void updateById(User user) {
        userMapper.updateByPrimaryKey(user);
    }

    public User select(int id) {
        return userMapper.selectByPrimaryKey(id);
    }

    public User selectByUserId(int userId) {
        return userMapper.selectByUserId(userId);
    }
}
